import yaml
import os
import sys
from os.path import abspath, dirname


def yaml_config_reader(yaml_file:os.path):
    if(os.path.isfile(yaml_file)):        
        print("Reading config data from file:\n{}".format(yaml_file))
        with open(yaml_file, mode='r', encoding='utf-8') as f:
            config = yaml.load(f.read(), Loader=yaml.FullLoader) 
    else:
        print("Not found data from file:\n{}".format(yaml_file))
        config = None
    return config  
  

if __name__=='__main__':
    test_yamlfile = os.path.join(dirname(dirname(abspath('__file__'))),'config','mvtec','draem_train_config.yaml')
    if(os.path.isfile(test_yamlfile)):
        config =  yaml_config_reader(test_yamlfile)
        print(config)
    else:
        print("Not found test config yaml file:{}".format(test_yamlfile))
        






